/**
 * Created by Administrator on 2017/4/21.
 */
var pool = require('./MysqlDBconnection');
module.exports.sqlStatement = function (_param,callBack){
    pool.getPoolConnection('crawler', function (err, connection) {
        if (err) {
            console.log('[Mysql logs]: get connection from pool in crawler: ', err);
            return;
        }

        var sql = _param.sqlStatement;

        connection.query(sql,_param.arr,function (queryErr, rows) {
            if (queryErr) {

                console.log('[Mysql logs]: something borken in querySQL ->', queryErr);

                callBack({
                    isSuccess: false
                });

            } else {

                callBack({
                    isSuccess: true,
                    result: rows
                })

            }

            connection.release();

        })

    });

};

